function updateStatus() {
    $.getJSON('/update', function(data) {
      var status = data['status'];
      for (var i = 0; i < status.length; i++) {
        var line = i + 1;
        var statusCell = $("#l" + line + "_line_state");
        statusCell.text(status[i]);
        statusCell.removeAttr("style");
        if (status[i].includes('CONNECTED')) {
             statusCell.css('background-color', '#CD5C5C');
             statusCell.css('color', 'black');
         } else if (status[i].includes('IDLE')) {
             statusCell.css('background-color', '#ADFF2F');
             statusCell.css('color', 'black');
         } else if (status[i].includes('DIALING') || status[i].includes('ALERTING')) {
             statusCell.css('background-color', '#FFFACD');
             statusCell.css('color', 'black');
         }
       }
     });
   }
   setInterval(updateStatus, 5000);